interface FoodInterface{

    public abstract void fun();
    void show();
}
class Milk implements FoodInterface{
    private String name;

    private int month;

    private int day;

    public Milk(String name, int month, int day) {
        this.name = name;
        this.month = month;
        this.day = day;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public int getDay(){
        return this.day;
    }
    public void setDay(){
        this.day=day;
    }
    public Milk(int day){
        this.day=day;
    }
    public void fun(){
        day=day+14;
        if(day>30){
            month=month+1;
            day=day-30;
        }
    }
    public void show(){
        System.out.println("牛奶的保质期截止日期:"+this.month+" "+this.day);
    }
}
class Bread implements FoodInterface{
    private String name;

    private int month;

    private int day;

    public Bread(String name, int month, int day) {
        this.name = name;
        this.month = month;
        this.day = day;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public void  fun(){
        if(getMonth()>=6&&getMonth()<=8){
          day=day+3;
          if(day>30){
              day=day-30;
              month=month+1;
          }
        }else{
            day=day+7;
            if(day>30){
                day=day-30;
                month=month+1;
            }
        }


    }
    public void show(){
        System.out.println("面包的保质期截止日期:"+this.month+" "+this.day);
    }
}
public class Test {
   public  static void calculate(FoodInterface f){
f.show();
    }
    public static void main(String[] args) {
     Milk milk=new Milk("MIlk",7,18);
     Bread bread=new Bread("Bread",7,30);
     milk.fun();
     bread.fun();
    calculate(milk);
    calculate(bread);
    }
}
